package org.icop.virtdoc;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.icop.utils.AnnotationHandler;

public class VirtualDocParams {
	
	public static boolean useStemming = true;
	public static String stemmingLanguage = "english";
		
	/**
	 * Enable the usage of stopwords. Note that we have only
	 * English stopwords. 
	 */
	public static boolean useStopwords = true;
	
	/**
	 * Assign weights (\in [0...1]) to all attributes.
	 * If a term occurs in multiple attributes, the weights are summed up.
	 */
	private static Map<String,Float> attributeWeights = new HashMap<String, Float>();
	static {
		attributeWeights.put(AnnotationHandler.ANNOTATION_ID, 0f);
		attributeWeights.put(AnnotationHandler.ANNOTATION_INPUT, 1.0f);
		attributeWeights.put(AnnotationHandler.ANNOTATION_OUTPUT, 1.0f);
		attributeWeights.put(AnnotationHandler.ANNOTATION_RESPONSIBLE, 1.0f);
		attributeWeights.put(AnnotationHandler.ANNOTATION_LABEL, 1.0f);
		attributeWeights.put(AnnotationHandler.ANNOTATION_DESCRIPTION, 0.5f);
		attributeWeights.put(AnnotationHandler.ANNOTATION_DATA, 1.0f);
	  }

	public static float getAttributeWeight(String attribute) {
		if (attributeWeights.containsKey(attribute))
			return attributeWeights.get(attribute);
		
		System.err.println("Warning: No weight for attribute \"" + attribute + "\".");
		return 0f;
		
	}
	
	private static List<String> ignoreAttributes = new ArrayList<String>();
	static {
		ignoreAttributes.add(AnnotationHandler.ANNOTATION_ID);
	  }
	
	public static boolean shouldIgnoreAttribute(String attribute) {
		return ignoreAttributes.contains(attribute);
	}
	
	
	/**
	 * Assign a weight factor (\in [0...1]) for the neighbours. Note that 
	 * the attribute specific weights are multiplied by this factor if a 
	 * term occurs at a neighbour.
	 */
	public static Float neighborWeightFactor = 0.5f;

}
